<!--<h3 id="deals-title"><span>Hàng mới</span></h3> -->
<div id="featured-scroller">
	<span id="scroll-new-features" style="position: absolute; z-index: 9999; left: -16px; top:-40px;">
		<span class="amount">Hàng mới</span>
	</span>
	<a href="#" class="featured-controller" id="left-nav"><div class="prev"></div></a>
	<a href="#" class="featured-controller" id="right-nav"><div class="next"></div></a>
	<div id="featured-slider" class="clearfix">	
	    <ul id="items">
	    	<?php 
			$products = new WP_query();

			$agrs = array(
					'product_cat' => 'hang-moi',
				    /* chỉ lấy post dạng product */
				    'post_type' => 'product',

				    'sort_by' => 'id'
				);

			$products->query($agrs);

			// var_dump($products);

			if($products->have_posts()) : while($products->have_posts()) : $products->the_post();
			?>
			<li>
				<?php 
				global $product;	
				$image_attributes = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID),'larger');
				?>
				<div class="item">
					<div class="item-top"></div>
							
					<div class="item-content">
												
						<!-- <span class="tag"><?php echo $product->get_price_html(); ?></span> -->
						<a href="<?php the_permalink(); ?>">
						<img style="height: 260px; width:170px;" src="<?php echo $image_attributes[0];?>" />
					
						</a>		
						<?php 
						//Kiểm tra xem sản phẩm còn hàng mới hiện giá ra
						if($product->is_in_stock()){
							if($product->is_on_sale() ){ ?>
							<span class="tag" style="position: absolute; z-index: 9999; left: -16px;"><del><?php echo  woocommerce_price($product->regular_price); ?></del></span>													
						<?php }else {?>
							<span class="tag" style="position: absolute; z-index: 9999; left: -16px;"><?php echo  woocommerce_price($product->get_price()); ?></span>		
							<!-- <span class="onsale-price" style="top: 230px;"><?php echo  woocommerce_price($product->get_price()); ?></span> -->
						<?php }
						}	?>
						<!-- <h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4> -->
						<?php //<a href="<?php the_permalink(); " class="more"><span>Xem chi tiết</span></a> ?>
					
						<?php //Kiểm tra có sản phẩm có hết hàng hay không ?>
						<?php if(!$product->is_in_stock()){
							echo '<span class="band outofstock"></span>';
							}
							//nếu không thì kiểm tra coi có giảm giá hay không
							elseif($product->is_on_sale() ){ 
							/**
							 * woocommerce_before_shop_loop_item_title hook
							 *
							 * @hooked woocommerce_show_product_loop_sale_flash - 10
							 */								
								do_action( 'mv_product_sale_flash' );
							}
							//kiểm tra xem có phải hàng mới hay không
							else{
								$product_terms  = wp_get_post_terms( $post->ID, 'product_cat' );
								foreach($product_terms as $term){
									if($term->slug == 'hang-moi'){
										// bỏ cái màu xanh trên sản phẩm sale trên scroll vì khách không muốn
										// echo '<span class="band buygetone"></span>';
									}
								}
							}
						?>	
						<?php //<h4><a href=""> the_title();</a></h4> ?>
					</div> <!-- .item-content -->		

					<?php //<a href="http://elegantthemes.com/preview/eStore/?p=219" class="more">
						//<span>Xem chi tiết</span> </a>?>   
			</li>
				<?php endwhile;?>
				<?php else : ?>
					<p>sorry, no post to display</p>
			<?php endif; ?>
	    </ul>
	</div>
</div>